Circuit and method for evaluating fuzzy logic rules

ABSTRACT

In a data processing system (10) implementing a fuzzy logic operation, a switching mechanism (802) is implemented to provide a selection between a variable format rule base (803) and a fixed format rule base. The variable format rule base utilizes buffers between fuzzy input addresses and fuzzy output addresses, while the fixed format rule base does not require such buffers since a number of fuzzy input addresses and fuzzy output addresses is predetermined.

CROSS-REFERENCE TO RELATED APPLICATIONS

This Application is related to co-pending patent application entitled:

DATA PROCESSING SYSTEM FOR EVALUATING FUZZY LOGIC RULES AND METHODTHEREFOR, Ser. No. 08/363,434, Attorney Docket Number SC-02395A, by J.Greg Viot and filed on Dec. 22, 1994;

U. S. Pat. No. 5,295,229; and

U. S. Pat. No. 5,263,125,

each of which are hereby incorporated by reference herein.

TECHNICAL FIELD

This invention relates generally to a data processing system, and moreparticularly to execution of a fuzzy logic operation in a dataprocessing system.

BACKGROUND INFORMATION

Data processors have been developed to function as binary machines whoseinputs and outputs are interpreted as ones or zeroes, and no otherpossibilities may exist. While this works well in most situations,sometimes an answer is not simply "yes" or "no," but somewhere inbetween. A concept referred to as "fuzzy logic" was developed to enabledata processors based on binary logic to provide an answer between "yes"and "no."

Fuzzy logic is a logic system which has membership functions with fuzzyboundaries. Membership functions translate subjective expressions, suchas "a temperature is warm," into a value which typical data processorscan recognize. A label such as "warm" is used to identify a range ofinput values whose boundaries are not points at which the label is trueon one side and false on the other side. Rather, in a system whichimplements fuzzy logic, the boundaries of the membership functionsgradually change and may overlap a boundary of an adjacent membershipset. Therefore, a degree of membership is typically assigned to an inputvalue. For example, if a range of temperatures provide the membershipfunctions, an input temperature may fall in the overlapping areas ofboth the functions labeled "cool" and "warm." Further processing wouldthen be required to determine a degree of membership in each of themembership functions (i.e. the degree to which the current temperaturefits into each of the membership sets cool and warm).

A step referred to as "fuzzification" is used to relate an input to amembership function in a system which implements fuzzy logic. Thefuzzification process attaches concrete numerical values to subjectiveexpressions such as "the temperature is warm." These numerical valuesattempt to provide a good approximation of human perception.

After the fuzzification step, a step referred to as rule evaluation isexecuted. During the rule evaluation step, rule expressions that dependon fuzzy input values are evaluated to derive fuzzy outputs. Forexample, assume a rule to be evaluated may be stated as:

If (Temperature is warm) and (Pressure is high), then (Fan speed ismedium).

In this rule, two antecedents, "Temperature is warm" and "Pressure ishigh" must be evaluated to determine a rule strength of the consequence,"Fan speed is medium." During the rule evaluation step, the degree towhich an antecedent is true affects the degree to which the rule istrue. The minimum of the antecedents is applied as the rule strength ofthe consequence of the rule. Additionally, when more than one rule is tobe evaluated, a possibility exists for an action to be assigned morethan one rule strength. In such a situation, the rule strength with agreater value should be assigned to the action. Therefore, the action isassigned a rule strength of greatest value.

The last step in the fuzzy logic process is referred to as"defuzzification." This step resolves competing results of the ruleevaluation step into a single action. Defuzzification is the process ofcombining all of the fuzzy outputs into a composite result which may beapplied to a standard data processing system. For more information aboutfuzzy logic, refer to an article entitled "Implementing Fuzzy ExpertRules in Hardware" by James M. Sibigtroth, which is hereby incorporatedby reference herein. The article was published in the April 1992 issueof AI EXPERT on pages 25 through 31.

In summary, rules are made up of a series of premises (antecedents)followed by one or more actions (consequences). Each antecedentcorresponds to a fuzzy input and each action corresponds to a fuzzyoutput. In a hardware implementation of the rule evaluation step,dedicated connections and circuits are used to relate fuzzy inputs tofuzzy outputs. This approach often requires dedicated memory circuitryand is inflexible. In a software implementation of the rule evaluationstep, a program of instructions is used to evaluate rules. The softwareapproach is typically slower than the hardware approach and requires asignificant amount of program memory. In an industry where data must becomputed, moved, and manipulated as quickly as possible, fast executiontimes are essential. Therefore, software is not a viable solution forsome applications.

Therefore, a need exists for a circuit or method for performing the ruleevaluation step quickly, but without extensive hardware requirements.The speed typically associated with a hardware solution is neededwithout the dedicated circuit area usually associated with such asolution.

Cross-referenced U.S. Pat. No. 5,263,125, which is hereby incorporatedby reference herein, describes the use of a fuzzy rule base having avariable format, which allows rules to have any number of inputs andoutputs. This variable format rule base contains overhead buffering todelineate the rules. In contrast, in a fixed format rule base, each rulehas the same predetermined number of inputs and outputs, allowing therules to be evaluated without overhead buffering. As a result, a fixedformat rule base requires less memory to specify and less time toexecute. The drawback to fixing the rule base format is that each rulemust conform to a predetermined structure. Thus, there are advantagesand disadvantages to both rule base formats and, thus, there aresituations where one is desired over the other.

As a result of the foregoing, there exists a need for a circuit andmethod for providing the option of implementing a fixed or variableformat rule base within a fuzzy logic system.

BRIEF DESCRIPTION OF THE DRAWING

For a more complete understanding of the present invention, and theadvantages thereof, reference is now made to the following descriptionstaken in conjunction with the accompanying drawing, in which:

FIG. 1 illustrates in graph diagram form some general concepts and basicterminology used to describe fuzzy logic;

FIG. 2 illustrates in block diagram form a data processing system inaccordance with the present invention;

FIG. 3 illustrates in block diagram form an execution unit of FIG. 2;

FIG. 4 illustrates in logic circuit form a register swap logic circuitof FIG. 3;

FIG. 5 illustrates in memory map form an array of rules to be evaluatedin an internal memory of FIG. 2 in a variable format;

FIG. 6 illustrates in flow chart form a flow of functions performedduring execution of the REV instruction in accordance with a variableformat;

FIG. 7 illustrates in memory map form an array of rules to be evaluatedin an internal memory of FIG. 2 in a fixed format; and

FIG. 8 illustrates in flow chart form a flow of functions performedduring execution of a Rule Evaluation (REV) instruction in accordancewith the invention described herein.

DETAILED DESCRIPTION

In the following description, numerous specific details are set forthsuch as specific word or byte lengths, etc. to provide a thoroughunderstanding of the present invention. However, it will be obvious tothose skilled in the art that the present invention may be practicedwithout such specific details. In other instances, well-known circuitshave been shown in block diagram form in order not to obscure thepresent invention in unnecessary detail. For the most part, detailsconcerning timing considerations and the like have been omitted inasmuchas such details are not necessary to obtain a complete understanding ofthe present invention and are within the skills of persons of ordinaryskill in the relevant art.

Refer now to the drawings wherein depicted elements are not necessarilyshown to scale and wherein like or similar elements are designated bythe same reference numeral through the several views.

The present invention provides a circuit and a method for executing arule evaluation step in a fuzzy logic operation in a data processingsystem quickly and with a minimum amount of circuitry. The ruleevaluation step is encoded in a single instruction which is efficientlyexecuted without an excessive amount of added circuitry in the dataprocessing system. Therefore, the present invention provides aninstruction which allows the user of the data processing system toperform the rule evaluation step quickly without lengthy and timeconsuming software programs.

The instruction of the present invention, which is referred to with themnemonic label "REV," causes the data processing system to perform aseries of steps involving the retrieval of operands from memory and theperformance of arithmetic operations using those operands. If themembership function values for antecedents of the rule to be evaluatedand the consequences of that rule have been appropriately stored inmemory prior to execution of the REV instruction of the presentinvention, the execution of the REV instruction results in properevaluation of the rule. By assuming that the antecedents andconsequences are stored in memory in a particular format, and bythoughtfully using existing hardware where possible in the execution ofthe instruction, the present invention permits the efficient evaluationof fuzzy logic rules in a general purpose data processing system withvery little additional hardware. For instance, the overflow, or V bit,of a condition code register used in the course of performing signedarithmetic in the data processor, is used in the present invention as aflag in connection with the processing of operands from memory.

During a description of the implementation of the invention, the terms"assert" and "negate," and various grammatical forms thereof, are usedto avoid confusion when dealing with a mixture of "active high" and"active low" logic signals. "Assert" is used to refer to the renderingof a logic signal or register bit into its active, or logically true,state. "Negate" is used to refer to the rendering of a logic signal orregister bit into its inactive, or logically false state. Additionally,a hexadecimal value may be indicated by a "$" symbol preceding a value.

FIG. 1 provides a graph illustrating a few basic terms and concepts offuzzy logic. In the fuzzy logic system described in FIG. 1, a "systeminput" is temperature in degrees Fahrenheit. Four "membership functions"are provided to give labels to a range of temperatures. For example,from 0 degrees to 35 degrees, a temperature is labeled "cold."Similarly, from 25 degrees to 60 degrees, the temperature is labeled"cool." Notice that the boundaries of each of the membership setsoverlaps the boundaries of the adjacent sets. Therefore, a temperaturemay be in more than one membership set. For example, assume that thesystem input indicates a temperature of 58 degrees. Referring to FIG. 1,notice that 58 degrees is within the boundaries of both the cool andwarm membership sets. However, a degree of membership in each of themembership sets may be obtained. The system input has a degree ofmembership having a hexadecimal value of $33 for the cool membership setand a degree of membership having a hexadecimal value of $CC for thewarm membership set. If the system input had indicated a temperature of70 degrees, the temperature would have had a degree of membership with ahexadecimal value of $FF in the warm membership set. Likewise, thetemperature of 70 degrees would have a degree of membership having ahexadecimal value of $00 in the hot membership set. In the fuzzy logicsystem described in FIG. 1, a degree of membership may range from ahexadecimal value of $00 to $FF, which corresponds to a fraction from0.00 to 0.996. Those skilled in the art will recognize that a two placehexadecimal value may be represented by a single eight bit binary byte.

One implementation of the instruction and method of operation describedabove is implemented in a modified form of a MC68HC11 micro controller.The MC68HC11 is an eight bit micro controller which includes sixteen bitaddresses and storage registers and is available from Motorola, Inc. ofAustin, Tex. This implementation is illustrated in greater detail inFIG. 2. FIG. 2 depicts a data processing system 10 in which the ruleevaluation instruction may be implemented. Data processing system 10generally includes a central processing unit (CPU) 12, an oscillator 24,a power circuit 26, a timing circuit 28, an external bus interface 30,and an internal memory 32. CPU 12 generally has an execution unit 14, abus control logic circuit 16, an instruction decode logic circuit 18, acontrol unit 20, and a sequencer 22.

During operation, an "Osc 1" signal is provided to oscillator 24 via anexternal source, such as a crystal. The crystal is connected between theOsc 1 and Osc 2 signals to enable the crystal to oscillate. The Osc 1provides a "Clock" signal to a remaining portion of data processingsystem 10. Operation of a crystal oscillator is well known in the dataprocessing art and should be apparent to one with ordinary skill in theart.

Power circuit 26 receives both a "Vdd" and a "Vss" signal from anexternal power source. The Vdd signal provides a positive 5 volts andthe Vss signal provides a reference, or ground voltage. The Vdd and Vsssignals are provided to each of the remaining components of dataprocessing system 10. The routing of these signals is well known in dataprocessing art and will be apparent to one with ordinary skill in theart.

Timing circuit 28 receives the Clock signal and subsequently providesappropriate timing signals to each of CPU 12, external bus interface 30,and internal memory 32 via a Timing Control bus 38.

A plurality of address values are provided from external bus interface30 to an External Address bus 35. Similarly, a plurality of data valuesare communicated by external bus interface 30 via an External Data bus33. External bus interface 30 controls receipt and transmission ofaddress and data values between an external user and data processingsystem 10. External bus interface 30 communicates a plurality of addressand data values to a remaining portion of data processing system 10 viaan Internal Address bus 36 and an Internal Data bus 34, respectively.

Internal memory 32 functions to store information necessary for theproper operation of data processing system 10. Additionally, other datavalues may be stored therein if specified in a user program provided viaInternal Address bus 36 and Internal Data bus 34.

CPU 12 executes each of the instructions required during operation ofdata processing system 10. Internal Address bus 36 and Internal Data bus34 communicate information between execution unit 14 and a remainingportion of data processing system 10. Bus control logic circuit 16fetches instructions and operands. Each of the instructions is thendecoded by instruction decode logic circuit 18 and provided to controlunit 20 and sequencer 22. Control unit 20 and sequencer 22 maintain asequence of execution of each of the instructions to most efficientlyutilize the computing capabilities of data processing system 10.Additionally, control unit 20 includes a Micro-ROM memory (not shown)which provides a plurality of control information to each of executionunit 14, bus control logic 16, and instruction decode logic 18 via aMicro-ROM Control Bus 65. The plurality of control information isnecessary for proper execution of the REV instruction.

Execution unit 14 is illustrated in greater detail in FIG. 3. Executionunit 14 generally includes a data buffer 40, a first selector 42, asecond selector 44, a register swap logic circuit 46, a condition codelogic circuit 47, an A-input control circuit 48, an A-input multiplexor50, an arithmetic logic unit (ALU) 52, a B-input control circuit 54, aB-input multiplexor 56, an accumulator 58, a condition code register 60,and a comparator 72. In addition to accumulator 58 and condition coderegister 60, other storage registers may be implemented in executionunit 14. For example, an index register or a second accumulator may alsobe included. Implementation and use of such storage registers is wellknown in the art and will be apparent to one with ordinary skill in theart.

An External Information bus 41 provides address and data information todata buffer 40. External Information bus 41 receives the address anddata information from Internal Address bus 36 and Internal Data bus 34,respectively. Data buffer 40 provides the values transferred viaExternal Information bus 40 to remaining portions of execution unit 14via an Information Bus A 66 and an Information Bus B 64 when selectors42 and 44 are respectively enabled to allow information to betransferred. Although not shown in detail here, both Information Bus A66 and Information Bus B 64 are sixteen bits wide and are divided into ahigh side (bit 15 through bit 8) and a low side (bit 7 through bit 0).Additionally, data buffer 40 provides address information to comparator72.

A first and a second input of accumulator 58 are bidirectionally coupledto Information Bus A 66 and Information Bus B 64, respectively. Anyadditional registers such as accumulators and index registers would besimilarly coupled to Information Bus A 66 and Information Bus B 64.

A plurality of control signals are provided to both A-input controllogic 48 and B-input control logic 54 via the Micro-ROM Control bus 65.Micro-ROM Control bus 65 provides the plurality of control signals inresponse to information provided by a Micro-ROM memory (not shown) incontrol unit 20.

A-input control 48 provides a "Control A" signal to a control input ofA-input multiplexor 50. Information Bus A 66 is connected to a datainput of A-input multiplexor 50. A-input multiplexor 50 provides both afirst ten bit output labeled "A-Input Low Side" to a first input of ALU56 and a second ten bit output labeled "A-Input High Side" to a secondinput of ALU 56. B-Input control 54 provides a "Control B" signal to acontrol input of B-input multiplexor 56. Information Bus B 64 isconnected to a data input of B-input multiplexor 56. B-input multiplexor56 provides both a first ten bit output labeled "B-Input Low Side" to athird input of ALU 56 and a second ten bit output labeled "B-Input HighSide" to a fourth input of ALU 56.

ALU 52 processes each of the inputs to provide a plurality of resultswhich are transferred via a Results bus 120. Results bus 120 providesthe results provided by ALU 52 to register swap logic 46 and conditioncode logic 47. Additionally, Results bus 120 provides the plurality ofresults to Information Bus B 64.

Condition code logic 47 is also coupled to comparator 72 to receive aToggle signal. Condition code logic 47 is coupled to condition coderegister 60 to provide a "Condition Code" signal.

Condition code register 60 provides a V_(CCR) signal to a second controlinput of register swap logic 46. Additionally, a Timing Control signalis provided to a first control input of register swap logic 46. TheTiming Control signal is provided via Timing Control Bus 38. Registerswap logic 46 provides a first and a second output, respectively labeled"Enable A" and "Enable B." The Enable A signal is provided to a firstcontrol input of selector 42. Information Bus A 66 is bidirectionallycoupled to selector 42. An output of selector 42 is coupled to databuffer 40 to communicate a plurality of selected signals. Similarly, theEnable B signal is provided to a first input of selector 44. InformationBus B 64 is bidirectionally coupled to selector 44. An output ofselector 44 is coupled to data buffer 40 to communicate a secondplurality of selected signals.

Register swap logic 46 is illustrated in greater detail in FIG. 4.Generally, register swap logic 46 includes an AND gate 62, an AND gate70, and an inverter 68. The V_(CCR) signal provides a first input to ANDgate 62 and an input to inverter 68. An output of inverter 68 provides afirst input to AND gate 70. The Timing Control signal provides a secondinput to both AND gate 62 and AND gate 70. Results bus 120 provides asignal labeled "N" from ALU 52 to a third input of both AND gate 62 andAND gate 70. An output of AND gate 62 provides the Enable A signal andthe output of AND gate 70 provides the Enable B signal.

During execution of a fuzzy logic operation, a user of data processingsystem 10 may use an instruction with the mnemonic REV (Rule EValuation)to perform the rule evaluation step on fuzzy inputs. As was previouslystated, fuzzy inputs are provided as a result of a fuzzification step inwhich a system input signal is assigned a degree of membership to eachof a plurality of defined membership sets. In the implementation of theinvention described herein, each of the degrees of membership assignedto a fuzzy input is stored in a predetermined memory location in theinternal memory 32 of data processing system 10 prior to execution ofthe REV instruction. Assignation of each of the degrees of membership toa plurality of fuzzy inputs is disclosed in more detail in thecross-referenced co-pending patent application, Ser. No. 07/899,975,entitled, "A Circuit And Method For Determining Membership In A SetDuring A Fuzzy Logic Operation," by J. Greg Viot, James M. Sibigtroth,and James L. Broseghini.

Assume, in the example described herein, that two groups of membershipsets are used during fuzzification of a first and a second system input.A first one of the two groups provides temperature measurements whichare separated into membership sets of cold, cool, warm, and hot. Whenfuzzified, a degree of membership of the first system input in the coolmembership set is referred to using a variable labeled T_(cool).Similarly, a degree of membership of the first system input in each ofthe cold, warm, and hot membership sets is referred to a respective oneof the linguistic variables T_(cold), T_(warm) , and T_(hot).

A second one of the two groups provides pressure measurements which areseparated into membership sets of light, medium, and heavy. Whenfuzzified, a degree of membership of the second system input in thelight, medium, and heavy membership sets is referred to using one of thelinguistic variables respectively labeled P_(light), P_(medium), andP_(heavy). After the system inputs have been fuzzified, the degree ofmembership of the first and second system inputs in each of therespective membership sets is stored in a predetermined location inmemory. Additionally, rules must be evaluated to provide appropriateactions. Assume in this example that three rules which are to beevaluated have the following forms:

(1) Rule 1: If temperature is cool (T_(cool)) and pressure is light(P_(light)), then (Action 1) and (Action 2);

(2) Rule 2: If temperature is warm (T_(warm)) and pressure is medium(P_(medium)), then (Action 3); and

(3) Rule 3: If pressure is medium (P_(medium)), then (Action 3).

Note that each of the rules has a form which typically has the form:

(4) If (Fuzzy Input 1) and (Fuzzy Input 2), then (Action X) and (ActionY).

During rule evaluation, the "if" portion of the rule is evaluated firstto determine a minimum degree of membership value. The "if" portion ofthe rule includes both the Fuzzy Input 1 value and the Fuzzy Input 2value. A common method to determine rule strength is to determine aminimum degree of membership of the fuzzy inputs being evaluated. Otherimplementations do exist, however. For example, a strength of a rule maybe calculated as the sum of the degrees of membership of each of itsantecedents; Similarly, the degrees of membership may be multiplied ormanipulated in any type of calculation to determine a rule strength.

In this implementation, the strength of the rule is only as strong asthe weakest component. The weakest degree of membership value is used todetermine a rule strength value of each of the actions specified in the"then" portion of the rule. In the rule shown in form (4), a rulestrength corresponding to a minimum of the Fuzzy Input 1 and Fuzzy Input2 values is stored in a first and a second address location in internalmemory 32 pointed to by the addresses of the Action X and Action Yvalues, respectively. Each of the rule strengths corresponding to apredetermined one of the plurality of action values is used to provide afuzzy output value which corresponds to a respective action. The fuzzyoutput value may then be defuzzified to perform an operation specifiedby the user. Although only two fuzzy input values and two action valuesare provided in form (4), either more or less values may be provided.The user of data processing system 10 determines the form of the rulesand may provide any number of fuzzy inputs or actions to be performed.

Additionally, when more than one rule is to be evaluated, a possibilityexists for an action to be assigned more than one rule strength. In sucha situation, the rule strength with a greater value should be assignedto the action. Therefore, the action is assigned a rule strength ofgreatest value.

In the implementation of the invention described herein, internal memory32 is generally used for memory storage. However, other memory circuits(not shown) external to data processing system 10 may also be used.Implementation and use of such external memory circuits is well known inthe data processing art and should be apparent to one of ordinary skill.In this implementation, each of the fuzzy inputs is stored in internalmemory 32 in the form:

    ______________________________________                                        Memory Address  Fuzzy Inputs Comment                                          ______________________________________                                        $1000           $00          Tcold                                            $1001           $33          Tcool                                            $1002           $CC          Twarm                                            $1003           $00          Thot                                             $1004           $00          Plight                                           $1005           $FF          Pmedium                                          $1006           $00          Pheavy                                           ______________________________________                                    

As illustrated in Array 1, for the two system inputs, temperature andpressure, a degree of membership denoted as a "Fuzzy Input" is providedfor each membership set for each system input. As was previouslydescribed with reference to FIG. 1, a first system input is atemperature of 58 degrees Fahrenheit. The temperature of 58 degreesFahrenheit was fuzzified to have a degree of membership of $00 in thecold and hot membership sets, a degree of membership of $33 in the coolmembership set, and a degree of membership of $CC in the warm membershipset. As shown in Array 1, the values of both the T_(cold) and T_(hot)variables are $00, which indicates that the first system input is not ineither of those two membership sets. However, the first system input hasa T_(cool) with a value of $33 and a T_(warm) with a value of $CC.Therefore, the first input does have a degree of membership of $33 inthe cool membership set and a degree of membership of $CC in the warmmembership set.

Similarly, a second input is fuzzified to indicate a degree ofmembership of $00 in both the light and heavy pressure membership sets.Therefore, the values of both the P_(light) and P_(heavy) variables are$00, which indicates that the second input is not included in either ofthose two membership sets. However, the second input does have a degreeof membership of $FF in the moderate membership set. Therefore, theP_(medium) variable has a value of $FF.

Like the fuzzy inputs, each of the rules to be evaluated (Rule 1 throughRule 3) is also stored in a rule array in internal memory 32. One suchrule array is illustrated in FIG. 5 in a variable format. For each rule,address locations for both the fuzzy inputs and the fuzzy outputs areprovided. The addresses of the fuzzy inputs and fuzzy outputs are storedin the form of FIG. 5 and reference a table of data values such as thatpreviously shown in Array 1. Like the fuzzy inputs, the table of datavalues corresponding to the fuzzy outputs is also provided in an arraywhich is not shown in detail herein.

A start of the rule array is located at a predetermined addressspecified by a user of data processing system 10. In the exampledescribed herein and illustrated in FIG. 5, the predetermined address isequal to $E000 and is stored in the index register prior to execution ofthe REV instruction. An address of a first one of the fuzzy inputs for aRule 1 is located at hexadecimal address $E000, the start of the rulebase. In this example, T_(cool) is the first fuzzy input for Rule 1 andan address of $1001 is stored at address $E000 of the rule array.Because the P_(light) value is the second fuzzy input of Rule 1, anaddress of $1004 is stored in the rule array at address $E002.

With respect to a variable format rule base, to separate the fuzzyinputs from the fuzzy outputs, a buffer with a value of $FFFE is storedin the rule array at address $E004. Subsequently, the fuzzy outputs ofRule 1 are separated from the fuzzy inputs of Rule 2 by a buffer with avalue of $FFFE. This format, in which any number of fuzzy inputs isseparated from any number of fuzzy outputs, by a buffer with a value of$FFFE is repeated until each of the fuzzy inputs and outputs of theplurality of rules is stored in memory. At that point, a special buffervalue indicates the end of the rule base. In the example describedherein, the end of the rule base is denoted by a value of $FFFF.Although the same buffer value is used to separate the fuzzy inputs fromthe fuzzy outputs of each rule, any number of buffers may be used by thedesigner of data processing system 10.

By placing each of the fuzzy inputs and outputs for each of the rules insuch an order, each of the rules may be evaluated sequentially by usingthe buffer addresses as an indicator of a division between each of thefuzzy input and output sections. Therefore, the rules do not have tofollow a fixed format with a specific number of fuzzy inputs and fuzzyoutputs (actions). This allows for greater flexibility in providingrules for the fuzzy system. As may be seen in Rule 1, Rule 2, and Rule 3(1), (2), and (3)!, the number of fuzzy inputs and corresponding actionsmay vary from rule to rule in this implementation of the invention.

In contrast, refer next to FIG. 7, which illustrates a memory rule arrayin a fixed format of two inputs and one output. Please note that thefixed format may be implemented with any predetermined number of fuzzyinputs and fuzzy output address pointers. In this case, two inputs 701and 702 are implemented, then one output 703, then two inputs 704 and705, etc. with the fixed format rule base ending with end mark 706 assimilarly implemented in the variable format rule array illustrated inFIG. 5. Supporting a particular fixed format rule base has merit inaddition to providing for execution and memory efficiency. First, allrule bases can be represented with the fixed format. Second, controlsurfaces of a fixed format rule base can be visualized; for example, atwo-input, one-output rule base can be visualized with athree-dimensional plot. Third, complex systems can be decomposed intotwo-input, one-output subsystems to avoid combinatorial explosion of therule matrix.

To provide a programmer, user, or a system the option of selectingbetween a fixed or variable format rule base, a switch mechanism isincorporated and implemented as a microcode branch based on the state ofa condition code bit (Zbit) implemented within condition code register60 illustrated in FIG. 3. In one implementation of the presentinvention, the Zbit (Z (zero) condition code bit) is used to signal themicrocode to use a fixed or variable format rule base, because the Zbitis not needed for its usual purpose during execution of the ruleevaluation instruction.

Referring next to FIG. 8, there is illustrated a flow diagram describingthis switch mechanism and the implementation of a fixed format rulebase. The process begins with step 801 wherein the REV instruction isdecoded. Next, in step 802, a determination is made whether or not apredetermination has been made that a variable format rule base or afixed format rule base is to be implemented. This is done with amicrocode branch instruction that determines if a Zbit (Z_(CCR)) isequal to 0 or 1. The Zbit may be located within condition code register60.

If this Zbit is equal to 0, the process will proceed to step 803 toprocess the fuzzy logic operation using the variable format rule baseaccording to the flow diagram shown in FIG. 6.

If the Zbit is equal to 1, the process will proceed to steps 804-810(discussed in further detail below) to implement the fuzzy logicoperation with a fixed format rule base such as the one illustrated inFIG. 7. Steps 804-810 illustrate a fixed format being of a two-inputone-output structure. However, as noted above, the fixed format may beprogrammed to have any predetermined number of fuzzy inputs and fuzzyoutputs.

Operation of steps 804-810 is similar to those steps illustrated in FIG.6, except that there is no need to evaluate whether or not the various$FFFE buffers have been encountered.

To begin execution of the REV instruction, each of the fuzzy inputs andoutputs of the rules are stored in memory in the rule array having oneof the predetermined formats illustrated in FIGS. 5 and 7. Additionally,the starting address of the rule array is stored in the index registerin execution unit 14 and each of the fuzzy outputs is assigned ahexadecimal value of $00. Finally, to prepare for processing of avariable format rule base, accumulator 58 is initialized with $FF whichforces Z_(CCR) =0 (variable format rule base) and V_(CCR) =0 (apre-condition required for proper operation of steps 606 and 613 in FIG.6). Alternatively, to prepare for processing of a fixed format rulebase, accumulator 58 may be initialized with $00 which forces Z_(CCR) =1(fixed format rule base). Execution of the REV instruction may then beperformed in accordance with one of the rule base formats illustrated inFIGS. 6 and 8. The flow charts will provide a brief overview of each ofthe functions performed during execution of the REV instruction foreither the variable or fixed format rule base. A more detailedexplanation of each of the functions will follow during a course of anexample of execution of the REV instruction.

As illustrated in FIG. 8, a first step in execution of the REVinstruction is performed when the REV instruction is decoded.

If the process proceeds to step 803, then the process in FIG. 6 isfollowed (step 601). The address stored in the index register, hereinreferred to as "X", is then used to fetch a first rule operand (step602). Address X is then incremented to point at a next address location(X+2) (step 603).

The value of the first rule operand is then tested to determine whetheror not the value equals hexadecimal $FFFE (step 604). If the valueequals hexadecimal $FFFE, the V_(CCR) signal is toggled to indicate thata buffer value was retrieved (step 605). If the V_(CCR) signal is equalto zero after being toggled (step 606), a first fuzzy input of a rule isto be evaluated and accumulator 58 should be initialized to ahexadecimal value of $FF (step 607). Otherwise, the value of accumulator58 is not modified.

If the value of the first rule operand is not equal to $FFFE (step 604),the value is tested to determine whether or not it equals hexadecimal$FFFF (step 608). If the value equals hexadecimal $FFFF, an end of therule array has been accessed and the REV instruction is terminated (step609).

If the value of the first rule operand is not equal to $FFFF, however,the value of the first rule operand is used to access a fuzzy input oroutput value from internal memory 32 (step 610). The contents ofaccumulator 58 are then subtracted from the fuzzy input or output valueto provide a signed result (step 611). The sign of the result isindicated by a value of the N signal.

If the N signal is equal to zero (step 612), then the contents of bothaccumulator 58 and data 40 should not be swapped and the address storedin the index register accesses a next rule operand (step 602). However,if the N signal is equal to one, the V_(CCR) signal is tested (step613).

If the V_(CCR) signal is equal to zero, the contents of accumulator 58should be replaced with the value of the fuzzy input value accessed bythe first rule operand (step 615). (Step 614 refers to the portion ofthe process when V_(CCR) is asserted indicating an evaluation of thefuzzy outputs, as described in more detail below.) Therefore, a minimumfunction is used to determine a rule strength which will be assigned tothe fuzzy outputs of the rule currently being evaluated. Next, theaddress stored in the index register is used to access a next ruleoperand (step 602).

The flow chart illustrated in FIG. 6 provides an overview of executionof the REV instruction in data processing system 10 when a variableformat rule base is to be implemented. As noted above, and as furtherdescribed below, implementation of the fixed format rule base inaccordance with the flow chart illustrated in FIG. 8 is similar toimplementation of the variable format rule base with one of the primarydifferences being that the buffers implemented to separate fuzzy inputsand outputs are not needed.

A more detailed example of the present invention will now be given.

The fundamental operation of the REV instruction is as follows: each ofthe antecedent values is retrieved from memory and a minimum antecedentvalue is determined, then each of the consequence values is retrieved,compared to the rule strength value and replaced in memory with thatrule strength value if and only if the pre-existing consequence value isless than the rule strength value.

As was previously described, the plurality of fuzzy inputs is stored ina first predetermined memory location in internal memory 32 by the userof data processing system 10 prior to execution of the REV instruction.This is true whether the fixed format or the variable format rule baseis implemented. The plurality of fuzzy inputs is stored in accordancewith Array 1. Additionally, each of the rules for evaluating theplurality of fuzzy inputs is also stored in a second predeterminedmemory location in internal memory 32 in one of the forms illustrated inFIGS. 5 and 7. Although not shown in detail herein, each of the rulestrength values corresponding to the fuzzy outputs is also stored ininternal memory 32 at a starting address of $2000 in an array similar toArray 1. The user of data processing system 10 will assign all of thevalues of the fuzzy outputs a hexadecimal value of $00 prior toexecution of the REV instruction. Additionally, the user of dataprocessing system 10 will initialize accumulator 58 to a hexadecimalvalue of $FF for variable rule bases or $00 for fixed rule bases priorto execution of the REV instruction. As was previously stated, whenaccumulator 58 is initialized to $FF indicating a variable format rulebase, the V_(CCR) signal is negated and the Z_(CCR) signal is negated.When a fixed rule base is used, accumulator 58 is initialized to $00which asserts the Z_(CCR) signal (the value of V_(CCR) is "don't care"for fixed rule bases).

During operation, a user may provide the REV instruction to dataprocessing system 10 through a software program stored either externallyor in internal memory 32. Should the REV instruction be provided by asource external to data processing system 10, the REV instruction wouldbe input via external data bus 33 to external bus interface 30. Externalbus interface 30 would subsequently provide the REV instruction to CPU12 via internal data bus 34. If the REV instruction was provided by asoftware program in internal memory 32, the REV instruction would beprovided to CPU 12 via internal data bus 34. In CPU 12, execution unit14 would provide the REV instruction to instruction decode logic circuit18 in response to control signals received from each of bus controllogic circuit 16, control unit 20, and sequencer 22. Additionally, eachof the components of CPU 12 receive timing control signals via TimingControl bus 38. Routing and use of such timing control signals are wellknown in the data processing art and, as such, will not be discussed indetail herein.

Instruction decode logic circuit 18 decodes the REV instruction toprovide a plurality of control and information signals necessary for theproper execution of the REV instruction. Upon receipt and decoding ofthe REV instruction, execution unit 14 begins the steps necessary toevaluate a plurality of fuzzy inputs stored in internal memory 32.Control unit 20 and sequencer 22 of CPU 12 in FIG. 2 collectivelyprovide a series of sequencing control signals necessary to transferpointers to the addresses of both the fuzzy inputs and the fuzzy outputsfrom internal memory 32 to execution unit 14.

To begin execution of the REV instruction, the index register (notshown) in execution unit 14 provides a pointer to the start of the rulebase. Index registers and their use in data processing systems arecommonly known in the data processing art and, therefore, are notexplained in detail herein. The pointer points to a starting address ofthe rule base in internal memory 32 where a degree of membership of thefirst input in the cool temperature membership set is stored. Theaddress indicates an address where the first fuzzy input value of Rule 1is stored. In the example described herein with respect to FIGS. 5 and7, hexadecimal address $1001 or the first input pointer is stored ataddress $E000 in internal memory 32.

In the case of the variable format rule base described in FIG. 6, whenthe address of the first fuzzy input value of Rule 1 is accessed fromthe rule array, the address is provided to data buffer 40 via ExternalInformation bus 41. Data buffer 40 subsequently provides the addressvalue to comparator 72 where the address value is compared to ahexadecimal value of $FFFE. If the address value is equal to $FFFE, abuffer address is pointed to and the V_(CCR) bit should be toggled.Traditionally, the V_(CCR) bit is used to indicate an overflow error ina signed arithmetic calculation. However, in this implementation of theinvention, the overflow bit (V_(CCR)) in a condition code register isset to indicate whether the accessed address corresponds to either afuzzy input address, a buffer address, or a fuzzy output address. Whenan address corresponding to the fuzzy inputs of a first rule isaccessed, the V_(CCR) bit remains negated. If the accessed addressaccessed is a buffer value, the V_(CCR) bit is toggled. In the exampledescribed herein, the buffer value is equal to a hexadecimal value of$FFFE. Additionally, when the addresses of the fuzzy outputs areaccessed, the V_(CCR) bit remains asserted.

When the address value equals $FFFE, comparator 72 asserts the Togglesignal. Condition code logic circuit 47 receives the Toggle signal andsubsequently provides an asserted Condition Code signal to conditioncode register 60. In turn, condition code register 60 either asserts ornegates the V_(CCR) signal accordingly.

In the example described herein, an address value of $1001 is accessedfrom address $E000, the address of the first fuzzy input value of Rule 1in the rule array. Because $1001 does not equal $FFFE, comparator 72does not assert the Toggle signal. Therefore, the Condition Code signalprovided by condition code logic circuit 47 does not enable conditioncode register 60 to toggle the V_(CCR) signal.

In the next step (step 608), comparator 72 compares the address value ofthe first fuzzy input of Rule 1 with a hexadecimal value of $FFFF. Ifthe address value is equal to $FFFF, an end of rule array address ispointed to and execution of the REV instruction is terminated (step609).

At this point, the following discussion will be in reference to theimplementation of a variable format rule base in accordance with FIGS. 5and 6. After the discussion of the implementation of the fuzzy logicsystem with a variable format rule base, a discussion will be providedbelow for an implementation of a fixed format rule base as illustratedwith respect to FIGS. 7 and 8.

When address $1001 is accessed from internal memory 32, a degree ofmembership of the first system input in the cool temperature membershipset is provided. As shown in Array 1, the degree of membership is equalto a hexadecimal value of $-33. Internal memory 32 provides theinformation to data buffer 40 of execution unit 14 via Internal Data bus34. External Information bus 41 provides information transferred viaboth Internal Address bus 36 and Internal Data bus 34.

The first fuzzy input ($33) is stored in data buffer 40 for subsequentprocessing. To determine a minimum degree of membership of theantecedents of Rule 1, the current contents of accumulator 58 ($FF) aresubtracted from the first fuzzy input ($33). To perform this function,the contents of accumulator 58 are provided to Information Bus A 66 andthe contents of data buffer 40 are provided to Information Bus B 64.Additionally, a plurality of control and timing signals are provided toexecution unit 14 via Micro-ROM control bus 65. The plurality of controland timing signals is provided as a result of decoding the REVinstruction by instruction decode logic 18 of FIG. 2.

In execution unit 14, the first fuzzy input is provided to A-inputmultiplexor 50 and the contents of accumulator 58 are provided toB-input multiplexor 56 at a point in time determined in accordance withthe timing signals transferred via Micro-ROM Control bus 65. B-inputcontrol circuit 54 provides a "Control B" signal to control operation ofB-input multiplexor 56. In this example, the Control B signal allowsB-input multiplexor 46 to pass an unmodified first fuzzy input value toALU 52. Similarly, A-input control circuit 54 provides a "Control A"signal to A-input multiplexor 50. The Control A signal allows A-inputmultiplexor 50 to negate the contents of accumulator 58 such that thecontents may be subtracted from the first fuzzy input in ALU 52.

Upon receipt of the first fuzzy input value and a negated accumulatorcontent value, ALU 52 subtracts the contents of accumulator 58 ($FF)from the first fuzzy input ($33) to provide a result. The result is anegative number ($33-$FF=-$CC) and the N signal is asserted. Theasserted N signal is transferred via Results bus 120. If the result hadbeen positive, the N flag would not have been set and a negated N signalwould have been provided via Results bus 120. The numerical result ofthe subtraction operation is not required and is, therefore, writtenover during subsequent arithmetic operations.

Register swap logic 46 allows the user to determine a minimum degree ofmembership in each of the fuzzy inputs of a rule and to subsequently usethat minimum degree of membership as a rule strength for each of theactions specified by the rule. During operation, register swap logic 46may or may not switch the contents of accumulator 58 and data buffer 40depending on values of the V_(CCR) and N signals.

Register swap logic 46 receives the V_(CCR) signal, N signal, and aTiming Control signal to control switching of the contents ofaccumulator 58 and data buffer 40. As was previously mentioned, when afuzzy input value is provided to execution unit 14 from internal memory32, the V_(CCR) signal remains negated. Additionally, ALU 52 providesthe N signal to indicate whether a result of a subtraction of thecontents of accumulator 58 from the contents of data buffer 40 ispositive or negative. If the contents of accumulator 58 are greater thanthe first fuzzy input which is stored in data buffer 40, the N signal isasserted to indicate a negative result. Conversely, if the first fuzzyinput is less than the contents of accumulator 58, the N signal remainsnegated to indicate a positive result. At an appropriate time determinedby timing circuit 28, the Timing Control signal is asserted to enableregister swap logic circuit 46 to either transfer the contents ofaccumulator 58 to data buffer 40, to transfer the contents of databuffer 40 to accumulator 58, or to let the contents of both accumulator58 and data buffer 40 remain the same.

During evaluation of the "if" portion of Rule 1, when the contents ofaccumulator 58 are subtracted from the first fuzzy input, a negativeresult is generated ($33-$FF=-$CC). Therefore, the N signal remainsasserted. Additionally, the V_(CCR) signal is negated to indicate that afuzzy input is being retrieved from internal memory 32. When the TimingControl signal is asserted, an output of AND gate 62 is equal to zeroand the Enable A signal is not asserted. However, the output of inverter68 is asserted and AND gate 70 is enabled to assert the Enable B signal.When the Enable B signal is asserted, selector 44 is enabled to transferdata from data buffer 40 to accumulator 58. The minimum degree ofmembership is, at this point, $33, and is stored in accumulator 58.

Similarly, the second fuzzy input of Rule 1 is provided to data buffer40. The second fuzzy input is the degree of membership the second systeminput has in the light pressure (P_(light)) membership set. In thisexample, the degree of membership has a hexadecimal value of $00. Again,internal memory 32 provides the degree of membership of the second fuzzyinput to data buffer 40 of execution unit 14 via External Informationbus 41.

To determine a minimum degree of membership, the first fuzzy input issubtracted from the second fuzzy input. In execution unit 14, the firstfuzzy input is provided to A-input multiplexor 50 and the second fuzzyinput is provided to B-input multiplexor 56 at a point in timedetermined in accordance with the timing signals transferred viaMicro-ROM Control bus 65. B-input control circuit 54 provides a "ControlB" signal to control operation of B-input multiplexor 56. In thisexample, the Control B signal allows B-input multiplexor 46 to pass anunmodified second fuzzy value to ALU 52. Similarly, A-input controlcircuit 54 provides a "Control A" signal to A-input multiplexor 50. TheControl A signal allows A-input multiplexor 50 to negate the first fuzzyinput such that it may be subtracted from the second fuzzy input in ALU52.

Upon receipt of the second fuzzy input value and a negated first fuzzyinput value, ALU 52 subtracts the first fuzzy input value from thesecond to again provide a negative result. Therefore, the N signal isasserted. Additionally, the V_(CCR) signal is negated to indicate that afuzzy input is being retrieved from internal memory 32.

When the Timing Control signal is asserted, an output of AND gate 62 isequal to zero and the Enable A signal is not asserted. In this firstexample, AND gate 70 does assert the Enable B signal. When the Enable Bsignal is asserted, selector 44 is enabled to transfer data from databuffer 40 to accumulator 58. Therefore, the minimum degree of membershipis, at this point, $00, and is stored in accumulator 58.

At the end of the memory locations of the fuzzy inputs for Rule 1, abuffer address is recognized by comparator 72. Comparator 72 provides anasserted Toggle signal to condition code logic circuit 47. Conditioncode logic circuit 47 then provides the Condition Code signal tocondition code register such that the V bit in condition code register60 is toggled to provide an asserted V_(CCR) signal. As was previouslyexplained, the V_(CCR) signal is asserted to indicate that an address ofa fuzzy output of Rule 1 is the next address to be retrieved frominternal memory 32. In the example described herein, the V_(CCR) signalis asserted during execution of the "then" portion of the REVinstruction when the addresses of the fuzzy outputs for Rule 1 areretrieved from internal memory 32.

When one of a plurality of fuzzy outputs is chosen, a maximum operationis performed. Therefore, for the "then" portion of the REV instruction,a maximum rule strength is assigned to each fuzzy output. As waspreviously explained, a maximum rule strength should be assigned foreach fuzzy output. Therefore, the minimum degree of membership valuestored in accumulator 58 as a result of execution of the "if" portion ofthe REV instruction is compared to a rule strength value currentlystored at the fuzzy output address in internal memory 32. The currentrule strength value resides stored in accumulator 58 during execution ofthe "then" part of the REV instruction. The maximum rule strength valueis always stored in internal memory 32. As was previously discussed, theminimum degree of membership value was calculated in a first part of theREV instruction where degrees of membership of each of the fuzzy inputsare compared to determine a minimum value.

The minimum value of the fuzzy inputs remains in accumulator 58. Theaddress pointers to fuzzy outputs of the rule currently being evaluatedare then provided from the rule array. The index register (not shown) inexecution unit 14 increments the pointer to point to an address of thefirst fuzzy output. In this example, the pointer is incremented toaddress $E006. At address $E006, an address of the first fuzzy output,hexadecimal address $2000, is provided. Because the user of dataprocessing system 10 assigns all data values stored in the fuzzy outputarray a hexadecimal value of $00 prior to execution of the REVinstruction, internal memory 32 provides a hexadecimal value of $00 whenaddress $2000 is accessed. The value of the fuzzy output ($00) is thenprovided to data buffer 40 via External Information bus 41 where thefuzzy output value is stored for subsequent operations.

To determine a maximum rule strength value, the contents of accumulator58 are subtracted from data buffer 40 to determine which has a greatervalue. In other words, the minimum degree of membership value calculatedduring the "if" portion of the rule evaluation step is subtracted fromthe rule strength value currently stored in the address location of thefirst fuzzy output of Rule 1. To perform this function, the contents ofaccumulator 58 are provided to Information Bus A 66 and the contents ofdata buffer 40 are provided to Information Bus B 64. Additionally, aplurality of control and timing signals are provided to execution unit14 via Micro-ROM control bus 65. The plurality of control and timingsignals is provided as a result of decoding the REV instruction byinstruction decode logic 18 of FIG. 2.

In execution unit 14, the minimum degree of membership value stored inaccumulator 58 is provided to A-Input multiplexor 50 and current fuzzyoutput value stored in data buffer 40 is provided to B-Input multiplexor56 at a point in time determined in accordance with the timing signalstransferred via Micro-ROM Control Bus 65. B-Input control circuit 54provides the Control B signal to control operation of B-Inputmultiplexor 56. In this example, the Control B signal allows B-Inputmultiplexor to pass an unmodified fuzzy output value from internalmemory 32 to ALU 52. Similarly, A-Input control circuit 48 provides theControl A signal to A-Input multiplexor 40. The Control A signal enablesA-Input multiplexor 50 to negate the contents of accumulator 58 for asubsequent subtraction operation in ALU 52.

Upon receipt of the values from both A-Input multiplexor 50 and B-Inputmultiplexor 56, ALU 52 subtracts the minimum degree of membership valuestored in accumulator 58 from the fuzzy output value stored at apredetermined memory location corresponding to the first fuzzy output ofRule 1. In the example described herein, the value stored in accumulator58 has a hexadecimal value of $00. Because each of the fuzzy outputs ofRule 1 is assigned a hexadecimal value of $00, the result provided byALU 52 is $00. Because the answer is not a negative number, the N signalremains negated and is subsequently provided to register swap logic 46.

As was previously discussed, condition code register 60 provides theV_(CCR) signal to register swap logic 46. Additionally, the TimingControl signal is provided by an external source, timing circuit 28, toregister swap logic 46. Upon receipt of each of the V_(CCR), N, andTiming Control signals, register swap logic 46 negates both the Enable Aand Enable B signals. Therefore, selectors 42 and 44 are respectivelynot enabled and do not allow a transfer of data between data buffer 40and accumulator 58. Accordingly, the rule strength of the first fuzzyoutput in internal memory 32 is not modified and continues to have ahexadecimal value of $00.

Similarly, during determination of a rule strength for the second fuzzyoutput of Rule 1, both the value stored in accumulator 58 and the rulestrength value retrieved from internal memory 32 have a hexadecimalvalue of $00. Therefore, ALU 52 again negates the N signal and registerswap logic 46 is subsequently enabled to negate both the Enable A andEnable B signals. Therefore, after evaluation of Rule 1, the rulestrength of each of the specified fuzzy outputs, Action 1 and Action 2,has a hexadecimal value of $00.

Again, at the end of the memory locations of the fuzzy outputs for Rule1, a buffer address is recognized by comparator 72. Comparator 72provides an asserted Toggle signal to condition code logic circuit 47.Condition code logic circuit 47 provides the Condition Code signal tocondition code register such that the V bit in condition code register60 is toggled to provide a negated V_(CCR) signal. As was previouslyexplained, the V_(CCR) signal is negated to indicate that an address ofa fuzzy input of Rule 2 is the next address to be retrieved frominternal memory 32. In the example described herein, the V_(CCR) signalis negated during execution of the "if" portion of the REV instructionwhen the addresses of the fuzzy inputs for Rule 2 are retrieved frominternal memory 32. When the V_(CCR) signal is negated, the contents ofaccumulator 58 are again initialized to a value of $FF.

Continuing execution of the REV instruction requires evaluation of Rule2. As was previously explained, control unit 20 provides a series ofsequencing control signals necessary to transfer each of the fuzzyinputs of Rule 2 from internal memory 32 to execution unit 14. Duringevaluation of Rule 2, internal memory 32 provides a first address wherea degree of membership of the first system input in the warm temperaturemembership set is stored therein. In the example described herein, theaddress would point to hexadecimal address $1002 in internal memory 32.When address $1002 is accessed from internal memory 32, a degree ofmembership with a hexadecimal value of $CC is provided to data buffer 40via Internal Data bus 34.

As during evaluation of Rule 1, the first fuzzy input of Rule 2 iscompared to the initialized contents of accumulator 58. Accumulator 58is again initialized to a hexadecimal value of $FF when the secondbuffer address was recognized. Therefore, the minimum value is detectedin accordance with the method previously described and a $CC is storedin accumulator 58.

Similarly, the second fuzzy input of Rule 2 is provided to data buffer40. The second fuzzy input is the degree of membership the second systeminput has in the medium pressure membership set. In this example, thedegree of membership has a hexadecimal value of $FF.

To determine a minimum degree of membership, ALU 52 subtracts the firstfuzzy input from the second fuzzy input to provide a result of apositive $33. Because the result is positive, the N flag is cleared anda negated N signal is provided via Results bus 120.

Subsequently, register swap logic 46 receives the V_(CCR) signal, Nsignal, and the Timing Control signal to control switching of thecontents of accumulator 58 and data buffer 40. Register swap logic 46negates both the Enable A and Enable B signals. the minimum degree ofmembership, a hexadecimal value of $CC, remains stored in accumulator58.

At the end of the memory locations of the fuzzy inputs for Rule 2, abuffer address is recognized by comparator 72. Comparator 72 provides anasserted Toggle signal to condition code logic circuit 47. Conditioncode logic circuit 47 then provides the Condition Code signal tocondition code register such that the V bit in condition code register60 is toggled to provide an asserted V_(CCR) signal. As was previouslyexplained, the V_(CCR) signal is negated to indicate that an address ofa fuzzy output of Rule 2 is the next address to be retrieved frominternal memory 32.

The minimum value of the fuzzy inputs of Rule 2 remains in accumulator58. The fuzzy outputs of the rule currently being evaluated are thenprovided from the rule array. The index register in execution unit 14increments the pointer to point to an address of the first fuzzy output.In this example, the pointer is incremented to address $E012. At address$E012, an address of the first fuzzy output, hexadecimal address $2002,is provided. Because the user of data processing system 10 assigns alldata values stored in the fuzzy output array a hexadecimal value of $00prior to execution of the REV instruction, internal memory 32 provides ahexadecimal value of $00 when address $2002 is accessed. The value ofthe fuzzy output ($00) is then provided to data buffer 40 via ExternalInformation bus 41 where the fuzzy output value is stored for subsequentoperations.

ALU 52 then subtracts the hexadecimal value of $CC stored in accumulator58 from the hexadecimal value of $00 stored in data buffer 40. A resultis a negative $CC value and the N signal is asserted. When each of theN, V_(CCR), and Timing signals are provided to register swap logic 46,register swap logic 46 asserts the Enable A signal and negates theEnable B signal.

When the Enable A signal is asserted, selector 42 is enabled to drivethe contents of accumulator 58 to data buffer 40. Data buffer 40temporarily stores the previous minimum degree of membership value ($CC)provided by accumulator 58 as a maximum rule strength value.Additionally, data buffer 40 transfers the maximum rule strength valueto the address location ($2002) of the first fuzzy output of Rule 2.Therefore, a value of $CC is the current rule strength value of Action 3at address $2002 in internal memory 32 at this point during execution ofthe REV instruction.

Again, at the end of the memory locations of the fuzzy outputs for Rule2, a buffer address is recognized by comparator 72. Comparator 72provides an asserted Toggle signal to condition code logic circuit 47.Condition code logic circuit 47 provides the Condition Code signal tocondition code register such that the V bit in condition code register60 is toggled to provide a negated V_(CCR) signal. As was previouslyexplained, the V_(CCR) signal is negated to indicate that an address ofa fuzzy input of Rule 3 is the next address to be retrieved frominternal memory 32. In the example described herein, the V_(CCR) signalis negated during execution of the "if" portion of the REV instructionwhen the addresses of the fuzzy inputs for Rule 3 are retrieved frominternal memory 32. When the V_(CCR) signal is negated, the contents ofaccumulator 58 are again initialized to a value of $FF.

Continuing execution of the REV instruction begins evaluating of Rule 3.As was previously explained, control unit 20 of CPU 12 provides a seriesof sequencing control signals necessary to transfer each of the fuzzyinputs of Rule 3 from internal memory 32 to execution unit 14. Duringevaluation of Rule 3, internal memory 32 provides a first address wherea degree of membership of the second system input in the medium pressuremembership set is stored therein. In the example described herein, theaddress would point to hexadecimal address $1005 in internal memory 32.When address $1005 is accessed from internal memory 32, a degree ofmembership with a hexadecimal value of $FF is provided to data buffer 40via Internal Data bus 34.

As was previously mentioned, the contents of accumulator 58 areinitialized to $FF when the V_(CCR) signal is negated. When the degreeof membership stored in data buffer 40 is subtracted from the contentsof accumulator 58 by ALU 52, a result of zero is produced. Because theresult is not negative, the N signal is not asserted. Therefore,register swap logic 56 does not assert either the Enable A or Enable Bsignals and information is not transferred between data buffer 40 andaccumulator 58.

At the end of the memory location of the fuzzy input of Rule 3, a bufferaddress is recognized by comparator 72. Comparator 72 provides anasserted Toggle signal to condition code logic circuit 47. Conditioncode logic circuit 47 then provides the Condition Code signal tocondition code register 60 such that the V bit in condition coderegister 60 is toggled to provide an asserted V_(CCR) signal. As waspreviously explained, the V_(CCR) signal is asserted to indicate that anaddress of a fuzzy output of Rule 3 is the next address to be retrievedfrom internal memory 32.

Subsequently, the address of the fuzzy output of Rule 3 is accessed frominternal memory 32 and a hexadecimal value of $CC is provided to databuffer 40. The hexadecimal value of $CC is provided as a result ofevaluation of Rule 2 in which the fuzzy output, Action 3, was assigned arule strength value of hexadecimal $CC. Therefore, hexadecimal value $CCis provided to data buffer 40.

ALU 52 then subtracts the hexadecimal value of $FF stored in accumulator58 from the hexadecimal value of $CC stored in data buffer 40. A resultis a negative $-33 value. When provided to register swap logic 46,register swap logic 46 asserts the Enable A. Therefore, selector 42 isenabled to communicate data from accumulator 58 to data buffer 40. Databuffer 40 transfers the minimum degree of membership value to theaddress location of the fuzzy output of Rule 3, the Action 3 output.Therefore, a hexadecimal value of $FF is the current rule strength valueof Action 3 at this point during execution of the REV instruction.

After evaluation of Rule 3, a special buffer address indicating an endof the array of rules to be evaluated is detected by comparator 72 andthe REV instruction is terminated. At that point, each of Rules 1, 2,and 3 has been evaluated and each of the corresponding fuzzy outputs hasbeen assigned a rule strength value. In the example described herein,each of Actions 1 and 2 has been assigned a rule strength value ofhexadecimal $00. Additionally, Action 3 has been assigned a rulestrength value of hexadecimal $FF. Each of the Actions is then providedas a fuzzy output to a defuzzification routine to be used to determineappropriate actions for data processing system 10. For example, Action 3may be defuzzified to open a valve or to turn on a fan. Additionally,the rule strength of Actions 1 through 3 may be defuzzified to determinea degree to which a fan is turned on or a valve is opened. Thedefuzzification operation is well known in the data processing art and,therefore, is not explained in detail herein.

Therefore, during execution of the REV instruction in data processingsystem 10, each of Rule 1, Rule 2, and Rule 3 were evaluated quickly andwith a minor amount of added circuitry. Most of the circuitry shown inFIG. 3 is generally used to perform general purpose processing in a dataprocessor. A small amount of additional memory in the Micro-ROM and asmall amount of added instruction decode logic is required to implementthe present invention. Additionally, in execution unit 14, comparator 72and register switch logic circuit 46 are required in addition to logictraditionally required.

With respect to FIG. 8, in step 804, the index register is used toaccess the first three rule operands, or pointers (701,702, 703), tothen access the two fuzzy inputs and the fuzzy output stored in internalmemory 32. In step 805, the address in the index register is thenupdated. In step 806, comparator 72 compares the address value of thefirst fuzzy input of Rule 1 with a hexadecimal value of $FFFF. If theaddress value is equal to $FFFF, an end of rule array address is pointedto and execution of the REV instruction is terminated (step 810).

Steps 807-809 illustrated in FIG. 8 do not require the implementation ofthe V_(CCR) bit and the processing related thereto. However, theimplementation of the fixed format rule base does utilize the hardwareillustrated in FIGS. 1-3 in a similar manner. After step 806, if the endmark 706 has not been reached, the process proceeds to step 807 whereinthe rule operands 1, 2 and 3 are utilized to fetch the two fuzzy inputs1 and 2 and the fuzzy output for a rule, respectively.

Thereafter, in step 808, one or more instructions are executed in orderto compute the new fuzzy output. This may be done in a manner assimilarly described above with FIG. 6. Essentially, the two fuzzy inputsare compared and the minimum value is then chosen. Then, this minimumvalue is compared with the retrieved fuzzy output value, and the maximumof these two is then chosen as the computed fuzzy output. Thereafter, instep 809, this new fuzzy output is written to the location indicated byrule operand 3. The process will then return to step 804 to continue thefuzzy logic operation for the next set of two fuzzy inputs and one fuzzyoutput.

The implementation of the invention described herein is provided by wayof example only. However, many other implementations may exist forexecuting the function described herein. For example, the start of therule base of the rules to be evaluated may be provided as an operand ofthe REV instruction. Additionally, a memory circuit external to dataprocessing system 10 may be used to store each of the rules and thefuzzy inputs used during evaluation of the rules. As well, although theN and V_(CCR) signals were used to control operation of register swaplogic 46 in this implementation of the invention, other signals withindata processing system 10 may be easily adapted for use. Additionally,the logic gates used in register swap logic 56 may also be replaced withother logic circuits such as NAND, OR, NOR, or Exclusive-OR gates.

While there have been described herein the principles of the invention,it is to be clearly understood to those skilled in the art that thisdescription is made only by way of example and not as a limitation tothe scope of the invention. Accordingly, it is intended, by the appendedclaims, to cover all modifications of the invention which fall withinthe true spirit and scope of the invention.

Although the present invention and its advantages have been described indetail, it should be understood that various changes, substitutions andalterations can be made herein without departing from the spirit andscope of the invention as defined by the appended claims.

We claim:
 1. A method for operating a digital data processor to performa fuzzy rule evaluation operation, said method comprising the stepsof:decoding a rule evaluation instruction; determining if a fixed orvariable format rule base is to be used with said rule evaluationinstruction; processing said rule evaluation instruction with said fixedformat rule base if it is determined that said fixed format rule base isto be used with said rule evaluation instruction; and processing saidrule evaluation instruction with said variable format rule base if it isdetermined that said variable format rule base is to be used with saidrule evaluation instruction.
 2. The method as recited in claim 1,wherein said step of processing said rule evaluation instruction withsaid fixed format rule base if it is determined that said fixed formatrule base is to be used with said rule evaluation instruction furthercomprises the steps of:1) retrieving address values from a predeterminednumber of memory locations; 2) comparing one of said address values to aboundary value and terminating said fuzzy rule evaluation operation ifsaid one of said address values matches said boundary value; 3) if saidfuzzy rule evaluation operation is not terminated, retrieving one ormore fuzzy input values and one or more fuzzy output values from memorylocations pointed to by said address values; and 4)computing a fuzzyoutput value using said one or more fuzzy input values and said one ormore fuzzy output values.
 3. The method as recited in claim 2, furthercomprising the steps of:5) writing said fuzzy output value computed instep 4); and repeating steps 1)-5).
 4. The method as recited in claim 2,wherein said memory locations are specified by a value contained in anindex register, further comprising the step of:incrementing said valuecontained in said index register.
 5. The method as recited in claim 2,wherein said computing step further comprises the steps of:determining aminimum of said fuzzy input values; and determining a maximum betweensaid minimum of said fuzzy input values and said fuzzy output valueretrieved in step 3).
 6. The method as recited in claim 1, wherein saidstep of processing said rule evaluation instruction with said variableformat rule base if it is determined that said variable format rule baseis to be used with said rule evaluation instruction further comprisesthe steps of:1) retrieving from a memory location an address value; 2)comparing the address value to a first boundary value and terminatingthe fuzzy rule evaluation operation if the address value matches thefirst boundary value; 3) comparing the address value to a secondboundary value and changing a state of a first flag signal if theaddress value matches the second boundary value; 4) if the address valuedoes not match either of the first and second boundary values and if thefirst flag signal is in a first state, retrieving from a memory locationspecified by the address value a membership function value andperforming a first arithmetic operation using the membership functionvalue; 5) if the address value does not match either of the first andsecond boundary values and if the first flag signal is in a secondstate, retrieving from a memory location specified by the address valuea consequence value, performing a second arithmetic operation using theconsequence value and selectively writing a result of the secondarithmetic operation to the memory location specified by the addressvalue; and 6) repeating steps 1)-5).
 7. The method as recited in claim 6wherein the step of performing a first arithmetic operation furthercomprises the steps of:subtracting a value contained in a data registerfrom the membership function value; and replacing the value contained inthe data register with the membership function value if a result of thestep of subtracting is negative.
 8. The method as recited in claim 7wherein the step of performing a second arithmetic operation furthercomprises the steps of:subtracting the consequence value from the valuecontained in a data register; and replacing the consequence value storedat the memory location specified by the address value with the valuecontained in the data register if the result of the step of subtractingis positive.
 9. A computer program product adaptable for storage in adata processing system, said computer program product operable foroperating a digital data processor to perform a fuzzy rule evaluationoperation, said computer program product comprising:instruction meansfor decoding a rule evaluation instruction; instruction means fordetermining if a fixed or variable format rule base is to be used withsaid rule evaluation instruction; instruction means for processing saidrule evaluation instruction with said fixed format rule base if it isdetermined that said fixed format rule base is to be used with said ruleevaluation instruction; and instruction means for processing said ruleevaluation instruction with said variable format rule base if it isdetermined that said variable format rule base is to be used with saidrule evaluation instruction.
 10. The computer program product as recitedin claim 9, wherein said instruction means for processing said ruleevaluation instruction with said fixed format rule base if it isdetermined that said fixed format rule base is to be used with said ruleevaluation instruction further comprises:instruction means forretrieving address values from a predetermined number of memorylocations; instruction means for comparing one of said address values toa boundary value and terminating said fuzzy rule evaluation operation ifsaid one of said address values matches said boundary value; instructionmeans for retrieving one or more fuzzy input values and one or morefuzzy output values from memory locations pointed to by said addressvalues if said fuzzy rule evaluation operation is not terminated; andinstruction means for computing a fuzzy output value using said one ormore fuzzy input values and said one or more fuzzy output values. 11.The computer program product as recited in claim 10, wherein saidcomputing instruction means further comprises:instruction means fordetermining a minimum of said fuzzy input values; and instruction meansfor determining a maximum between said minimum of said fuzzy inputvalues and said fuzzy output value.
 12. The computer program product asrecited in claim 9, wherein said instruction means for processing saidrule evaluation instruction with said variable format rule base if it isdetermined that said variable format rule base is to be used with saidrule evaluation instruction further comprises:instruction means forretrieving from a memory location an address value; instruction meansfor comparing the address value to a first boundary value andterminating the fuzzy rule evaluation operation if the address valuematches the first boundary value; instruction means for comparing theaddress value to a second boundary value and changing a state of a firstflag signal if the address value matches the second boundary value;instruction means for retrieving from a memory location specified by theaddress value a membership function value and performing a firstarithmetic operation using the membership function value if the addressvalue does not match either of the first and second boundary values andif the first flag signal is in a first state; and instruction means forretrieving from a memory location specified by the address value aconsequence value, performing a second arithmetic operation using theconsequence value and selectively writing a result of the secondarithmetic operation to the memory location specified by the addressvalue if the address value does not match either of the first and secondboundary values and if the first flag signal is in a second state.
 13. Adigital data processor operable for performing a fuzzy rule evaluationoperation, said processor comprising:instruction decode logic operablefor decoding a rule evaluation instruction; and an execution unitoperable for: determining if a fixed or variable format rule base is tobe used with said rule evaluation instruction; processing said ruleevaluation instruction with said fixed format rule base if it isdetermined that said fixed format rule base is to be used with said ruleevaluation instruction; and processing said rule evaluation instructionwith said variable format rule base if it is determined that saidvariable format rule base is to be used with said rule evaluationinstruction.
 14. The processor as recited in claim 13, wherein saidexecution unit is operable for performing the following functions if itis determined that said fixed format rule base is to be used with saidrule evaluation instruction:1) retrieving address values from apredetermined number of memory locations in an internal memory coupledto said execution unit; 2) comparing one of said address values to aboundary value and terminating said fuzzy rule evaluation operation ifsaid one of said address values matches said boundary value; 3) if saidfuzzy rule evaluation operation is not terminated, retrieving one ormore fuzzy input values and one or more fuzzy output values from memorylocations in said internal memory pointed to by said address values; and4) computing a fuzzy output value using said one or more fuzzy inputvalues and said one or more fuzzy output values.
 15. The processor asrecited in claim 13, wherein said execution unit is operable forperforming the following functions if it is determined that saidvariable format rule base is to be used with said rule evaluationinstruction:1) retrieving from a memory location in an internal memorycoupled to said execution unit an address value; 2) comparing theaddress value to a first boundary value and terminating the fuzzy ruleevaluation operation if the address value matches the first boundaryvalue; 3) comparing the address value to a second boundary value andchanging a state of a first flag signal if the address value matches thesecond boundary value; 4) if the address value does not match either ofthe first and second boundary values and if the first flag signal is ina first state, retrieving from a memory location in said internal memoryspecified by the address value a membership function value andperforming a first arithmetic operation using the membership functionvalue; and 5) if the address value does not match either of the firstand second boundary values and if the first flag signal is in a secondstate, retrieving from a memory location in said internal memoryspecified by the address value a consequence value, performing a secondarithmetic operation using the consequence value and selectively writinga result of the second arithmetic operation to the memory locationspecified by the address value.